//
// Created by admin on 2024/8/16.
//

#ifndef HBAND_MUSICCODE_H
#define HBAND_MUSICCODE_H

#endif //HBAND_MUSICCODE_H

#include <Arduino.h>

typedef struct {
    note_t note;    //音名
    uint8_t octave;  //音高
    uint8_t duration; //音长
}MusicNode_t;

typedef struct {
    const MusicNode_t* music;
    uint16_t musicsize;
    const char* name;
}MusicList_t;

#define MUSIC_DEF(name) static const MusicNode_t Audio_##name[] =
#define ADD_MUSIC(music) {Audio_##music,sizeof(Audio_##music)/sizeof(MusicNode_t),#music}

MUSIC_DEF(start)
{
    {NOTE_D,5,150},
    {NOTE_E,5,200},
    {NOTE_A,3,100}
};

MUSIC_DEF(poweroff){
    {NOTE_G, 4, 200},
    {NOTE_E, 4, 210},
    {NOTE_C, 4, 220},
};

MUSIC_DEF(music1){
    {NOTE_C,7,200},
    {NOTE_A,6,180},
    {NOTE_F,6,200},
};

MUSIC_DEF(music2){
    {NOTE_E,5,200},
    {NOTE_G,5,150},
    {NOTE_G,5,150},
    {NOTE_E,5,150},
    {NOTE_D,5,150},
    {NOTE_G,5,150},
    {NOTE_G,5,200},
};

static const MusicList_t MusicList[] = {
        ADD_MUSIC(start),
        ADD_MUSIC(poweroff),
        ADD_MUSIC(music1),
        ADD_MUSIC(music2),

};

